package com.huluobo.a2111douyindemo.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;

/**
 * Created by LC on 2024/3/1.
 */
public class VideoRecyclerView extends RecyclerView {

    private boolean isIntercept = true;

    public VideoRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public void setIntercept(boolean intercept) {
        isIntercept = intercept;
    }

    //拦截事件的方法

    @Override
    public boolean onInterceptTouchEvent(MotionEvent e) {
        if (!isIntercept) {
            return false;//返回false,表示拦截事件
        }
        return super.onInterceptTouchEvent(e);//默认返回true,不拦截事件
    }
}
